package com.lc.pianostudent.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONArray;
import org.json.JSONObject;

/**
 * Created by Administrator on 2018/2/22.
 */
@HttpInlet(Conn.GETPINTU)
public class PostGetPintu extends BaseAsyPost {

    public String user_id, xx, number, num, pintuid, pintunum;

    public PostGetPintu(AsyCallBack asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected PostGetPintuInfo parser(JSONObject object) throws Exception {
        if (object.optString("code").equals("200")) {

            PostGetPintuInfo info = new PostGetPintuInfo();

            info.code = object.optString("code");
            info.message = object.optString("message");
            info.type = object.optString("type");
            if(info.type.equals("true")){
                JSONObject jsonObject = object.optJSONObject("data");
                info.text = jsonObject.optString("text");
                info.picurl = jsonObject.optString("picurl");
            }
            TOAST = object.optString("message");

            return info;

        } else {

            TOAST = object.optString("message");

        }

        return null;
    }

    public static class PostGetPintuInfo {

        public String code, message,text,picurl,type;

    }

}
